<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>组件切换</title>
	<script src="./lib/vue-2.4.0.js"></script>
</head>
<body>
	<div id="app">
	    <a href="" @click.prevent="comName='login'">注册</a>
	    <a href="" @click.prevent="comName='register'">登录</a>
      <component :is="comName"></component>
	</div>

	<script>
       //创建两个组件
       Vue.component('login',{
       	  template:'<h1>注册事件</h1>'
       })

       Vue.component('register',{
       	  template:'<h1>登录事件</h1>'
       })

       var vm=new Vue({
       	  el:'#app',
       	  data:{
       	  	comName:'login'
       	  }
       });
	</script>
</body>
</html>